import React from 'react';
import ReactDOM from 'react-dom';
import {useState} from 'react'


function App() {

  const [state, setState] = useState(() => ({count: 0}))
  const [count, setCount] = useState(0)

  const addCount = () => {
    setState(state => ({count: state.count + 1}))
  }

  const addCount1 = () => {
    setCount(count - 1)
  }

  return (
    <div>
      {state.count}
      <br/>
      <button onClick={addCount}>+</button>
      <hr/>
      {count}
      <br/>
      <button onClick={addCount1}>-</button>
    </div>
  )
}

ReactDOM.render(
    <App />,
  document.getElementById('root')
)
